// require.ensure 是 Webpack 的特殊语法，用来设置 组件到底路径
/**
 * 1.定义路由，每个路由应该映射一个组件
 * path : 浏览器的显示的路径
 * name ： 路由的名字
 * component : 路由的组件路径
 */
import App from './App'
const NotFoundComponent = r => require.ensure([], () => r(require('./components/mainView/NotFoundComponent.vue')), 'NotFoundComponent');
const home = r => require.ensure([], () => r(require('./components/mainView/home.vue')), 'home');
const storeInfo = r => require.ensure([], () => r(require('./components/mainView/storeInfo.vue')), 'storeInfo');
const activityHome = r => require.ensure([], () => r(require('./components/mainView/activity/activityHome.vue')), 'activityHome');
const masterList = r => require.ensure([], () => r(require('./components/mainView/masterList.vue')), 'masterList');
const projectList = r => require.ensure([], () => r(require('./components/mainView/project/projectList.vue')), 'projectList');

const me = r => require.ensure([], () => r(require('./components/mainView/me.vue')), 'me');
const details = r => require.ensure([], () => r(require('./components/details/details.vue')), 'details');
const masterDetails = r => require.ensure([], () => r(require('./components/details/masterDetails.vue')), 'masterDetails');
const information = r => require.ensure([], () => r(require('./components/details/information.vue')), 'information');
const myqcode = r => require.ensure([], () => r(require('./components/meFunction/qrcode/myqcode.vue')), 'myqcode');
const boughtList = r => require.ensure([], () => r(require('./components/meFunction/purchaseHistory/boughtList.vue')), 'boughtList');
const mealTicketList = r => require.ensure([], () => r(require('./components/meFunction/purchaseHistory/mealTicketList.vue')), 'mealTicketList');
const ticketQcode = r => require.ensure([], () => r(require('./components/meFunction/qrcode/ticketQcode.vue')), 'ticketQcode');
const refreshPage = r => require.ensure([], () => r(require('./components/popupBox/refreshPage.vue')), 'refreshPage');
const payAffirm = r => require.ensure([], () => r(require('./components/payPage/payAffirm.vue')), 'payAffirm');
const userlist = r => require.ensure([], () => r(require('./components/meFunction/userlist.vue')), 'userlist');
const getMoney = r => require.ensure([], () => r(require('./components/meFunction/getMoney.vue')), 'getMoney');
const incomeExpense = r => require.ensure([], () => r(require('./components/meFunction/incomeExpense/incomeExpense.vue')), 'incomeExpense');
const projectImportHome = r => require.ensure([], () => r(require('./components/meFunction/projectImport/projectImportHome.vue')), 'projectImportHome');
const info = r => require.ensure([], () => r(require('./components/meFunction/info/info.vue')), 'info');
const bindPhone = r => require.ensure([], () => r(require('./components/meFunction/info/bindPhone.vue')), 'bindPhone');

const routers = [
  { path: '*', redirect: '/' },
  {
  path: '/',
  component:App,
  children: [
    {
        path: '',
        redirect: '/home'
    },
    {
      path: '/home',
      name: 'home',
      component:home,
      meta: { title: ' ', keepAlive:true}
    },
    {
      path: '/projectList',
      name: 'projectList',
      component:projectList,
      meta: { title: ' ', keepAlive:true }        
    },
    {
      path: '/activityHome',
      name: 'activityHome',
      component:activityHome,
      meta: { title: '最新资讯', keepAlive:false }
    },
    {
      path: '/masterList',
      name: 'masterList',
      component:masterList,
      meta: { title: '预约中心', keepAlive:true }        
    },
    {
      path: '/storeInfo',
      name: 'storeInfo',
      component:storeInfo,
      meta: { title: '店铺详情', keepAlive:true }        
    },
    {
      path: '/me',
      name: 'me',
      component:me,
      meta: { title: '个人中心', keepAlive:true }
    },
    {
      path: '/details/:detailsid',
      name: 'details',
      component:details,
      meta: { title: '商品详情' }
    },
    {
      path: '/masterDetails',
      name: 'masterDetails',
      component:masterDetails,
      meta: { title: '员工介绍' }
    },
    {
      path: '/information/:infoid',
      name: 'information',
      component:information,
      meta: { title: '资讯' }
    },
    {
      path: '/myqcode',
      name: 'myqcode',
      component:myqcode,
      meta: { title: '我的二维码' , keepAlive:true}
    },
    {
      path: '/boughtList',
      name: 'boughtList',
      component:boughtList,
      meta: { title: '购买记录' }
    },
    {
      path: '/mealTicketList/:mealid',
      name: 'mealTicketList',
      component:mealTicketList,
      meta: { title: '礼品券' }
    },
    {
      path: '/ticketQcode',
      name: 'ticketQcode',
      component:ticketQcode,
      meta: { title: '礼品券二维码' , keepAlive:true}
    },
    {
      path: '/refreshPage',
      name: 'refreshPage',
      component:refreshPage
    },
    {
      path: '/payAffirm',
      name: 'payAffirm',
      component:payAffirm,
      meta: { title: '支付确认' }
    },
    {
      path: '/userlist',
      name: 'userlist',
      component:userlist,
      meta: { title: '客户列表' }
    },
    {
      path: '/getMoney',
      name: 'getMoney',
      component:getMoney,
      meta: { title: '提现' }
    },
    {
      path: '/incomeExpense',
      name: 'incomeExpense',
      component:incomeExpense,
      meta: { title: '收支明细' }
    },
    {
      path: '/projectImportHome',
      name: 'projectImportHome',
      component:projectImportHome ,
      meta: { title: '项目引进' }     
    },
    {
      path: '/info',
      name: 'info',
      component:info,
      meta: { title: '个人信息' }
    },
    {
      path: '/bindPhone',
      name: 'bindPhone',
      component:bindPhone,
      meta: { title: '手机绑定', keepAlive:true }
    },
  ]
}
];

export default routers;
